package com.example.sql.manager.utils;

import com.example.sql.manager.entity.po.BasePO;

import java.util.Objects;

import static com.example.sql.manager.constants.Str.*;

public class UpdateUtils {

    public static void fillObj(BasePO basePO) {
        if (Objects.nonNull(basePO.getVersion())) {
            basePO.setVersion(basePO.getVersion() + 1);
        }
        //19700101235959
        TimeUtil timeUtil = new TimeUtil();
        String pattern = StringUtils.concat(SMALL_YYYY, BIG_MM, SMALL_DD, BIG_HH, SMALL_MM, SMALL_SS);
        String stampToDate = timeUtil.stampToDate(pattern, System.currentTimeMillis());

        basePO.setLastModifyDate(Long.valueOf(stampToDate));
    }
}
